package com.nokia.position;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.Writable;

public class PositionServiceUsageWritable implements Writable {
	private int totalCount;
	private int statusTrueCount;
	private long hAccuracyCount;

	// Used measurements
	private int mcc_system_id;
	private int mnc_network_id;
	private int lac_rnc_tac_rz;
	private int enb;
	private int cellid_baseid;
	private int neighbor_cell;
	private int wlan;
	private int reference_location;

	// WLAN + Neighbor_cell
	private int wlanPlusNeighborCell;
	// WLAN + CellID BaseID
	private int wlanPlusCellIDBaseID;
	
	// jpc
	// Provided Measurements
	private int pm_WLAN;
	private int pm_WLAN_cellular;
	private int pm_cellular;

	public PositionServiceUsageWritable(int count, int error, long hAccuracy,
			int mcc_system_id, int mnc_network_id, int lac_rnc_tac_rz, int enb,
			int cellid_baseid, int neighbor_cell, int wlan,
			int reference_location, int wlanPlusNeighborCell,
			int wlanPlusCellIDBaseID, int pm_WLAN, int pm_WLAN_cellular,
			int pm_cellular) {
		this.totalCount = count;
		this.statusTrueCount = error;
		this.hAccuracyCount = hAccuracy;
		// UM
		this.mcc_system_id = mcc_system_id;
		this.mnc_network_id = mnc_network_id;
		this.lac_rnc_tac_rz = lac_rnc_tac_rz;
		this.enb = enb;
		this.cellid_baseid = cellid_baseid;
		this.neighbor_cell = neighbor_cell;
		this.wlan = wlan;
		this.reference_location = reference_location;
		this.wlanPlusNeighborCell = wlanPlusNeighborCell;
		this.wlanPlusCellIDBaseID = wlanPlusCellIDBaseID;
		
		// Provided Measurements
		this.pm_WLAN = pm_WLAN;
		this.pm_WLAN_cellular = pm_WLAN_cellular;
		this.pm_cellular = pm_cellular;
	}

	public PositionServiceUsageWritable() {
		this(0, 0, 0L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	}

	public int getTotalCount() {
		return totalCount;
	}

	public int getStatusTrueCount() {
		return statusTrueCount;
	}

	public long gethAccuracyCount() {
		return hAccuracyCount;
	}

	public int getMccSystemId() {
		return mcc_system_id;
	}

	public int getMNCNetworkId() {
		return mnc_network_id;
	}

	public int getLacRncTacRz() {
		return lac_rnc_tac_rz;
	}

	public int getEnb() {
		return enb;
	}

	public int getCellidBaseId() {
		return cellid_baseid;
	}

	public int getNeighborCell() {
		return neighbor_cell;
	}

	public int getWlan() {
		return wlan;
	}

	public int getReferenceLocation() {
		return reference_location;
	}

	public int getWlanPlusNeighborCell() {
		return wlanPlusNeighborCell;
	}

	public int getWlanPlusCellIDBaseID() {
		return wlanPlusCellIDBaseID;
	}
	
	public int getPmWLANCount() {
		return pm_WLAN;
	}
	
	public int getPmWLANCellular() {
		return pm_WLAN_cellular;
	}

	public int getPmCellularCount() {
		return pm_cellular;
	}

	@Override
	public void readFields(DataInput arg0) throws IOException {
		totalCount = arg0.readInt();
		statusTrueCount = arg0.readInt();
		hAccuracyCount = arg0.readLong();

		// um
		mcc_system_id = arg0.readInt();
		mnc_network_id = arg0.readInt();
		lac_rnc_tac_rz = arg0.readInt();
		enb = arg0.readInt();
		cellid_baseid = arg0.readInt();
		neighbor_cell = arg0.readInt();
		wlan = arg0.readInt();
		reference_location = arg0.readInt();
		wlanPlusNeighborCell = arg0.readInt();
		wlanPlusCellIDBaseID = arg0.readInt();

		// pm
		pm_WLAN = arg0.readInt();
		pm_WLAN_cellular = arg0.readInt();
		pm_cellular = arg0.readInt();
	}

	@Override
	public void write(DataOutput arg0) throws IOException {
		arg0.writeInt(totalCount);
		arg0.writeInt(statusTrueCount);
		arg0.writeLong(hAccuracyCount);

		// um
		arg0.writeInt(mcc_system_id);
		arg0.writeInt(mnc_network_id);
		arg0.writeInt(lac_rnc_tac_rz);
		arg0.writeInt(enb);
		arg0.writeInt(cellid_baseid);
		arg0.writeInt(neighbor_cell);
		arg0.writeInt(wlan);
		arg0.writeInt(reference_location);
		arg0.writeInt(wlanPlusNeighborCell);
		arg0.writeInt(wlanPlusCellIDBaseID);
		
		// pm
		arg0.writeInt(pm_WLAN);
		arg0.writeInt(pm_WLAN_cellular);
		arg0.writeInt(pm_cellular);
	}

	public String toString() {
		return Integer.toString(totalCount)
				+ ", "
				+ Integer.toString(statusTrueCount)
				+ ", "
				+ Long.toString(hAccuracyCount)
				+ ", "
				// um
				+ Integer.toString(mcc_system_id) + ", "
				+ Integer.toString(mnc_network_id) + ", "
				+ Integer.toString(lac_rnc_tac_rz) + ", "
				+ Integer.toString(enb) + ", "
				+ Integer.toString(cellid_baseid) + ", "
				+ Integer.toString(neighbor_cell) + ", "
				+ Integer.toString(wlan) + ", "
				+ Integer.toString(reference_location) + ", "
				+ Integer.toString(wlanPlusNeighborCell) + ", "
				+ Integer.toString(wlanPlusCellIDBaseID) + ", "
				
				//pm
				+ Integer.toString(pm_WLAN) + ", "
				+ Integer.toString(pm_WLAN_cellular) + ", "
				+ Integer.toString(pm_cellular);
	}
}
